/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package backupit.core;

import java.io.File;

/**
 *
 * @author dbotelho
 */
public class FileInfo {

    private long lastTimeModified;
    private String relativePath;
    private String AbsolutePath;
    private long length;
    private String name;
    private boolean directory;
    
    public static FileInfo parse(File file){
        FileInfo fileInfo = new FileInfo();
        fileInfo.setDirectory(file.isDirectory());
        fileInfo.setAbsolutePath(file.getAbsolutePath());
        fileInfo.setLastTimeModified(file.lastModified());
        fileInfo.setLength(file.length());
        fileInfo.setName(file.getName());
        return fileInfo;
    }
    private FileInfo(){
        
    }

    public long getLastTimeModified() {
        return lastTimeModified;
    }

    public void setLastTimeModified(long lastTimeModified) {
        this.lastTimeModified = lastTimeModified;
    }

    public String getRelativePath() {
        return relativePath;
    }

    public void setRelativePath(String relativePath) {
        this.relativePath = relativePath;
    }

    public String getAbsolutePath() {
        return AbsolutePath;
    }

    public void setAbsolutePath(String AbsolutePath) {
        this.AbsolutePath = AbsolutePath;
    }

    public long getLength() {
        return length;
    }

    public void setLength(long length) {
        this.length = length;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isDirectory() {
        return directory;
    }

    public void setDirectory(boolean directory) {
        this.directory = directory;
    }
    
    @Override
    public String toString(){
        if(directory)
            return "<dir>"+name;
        return name;
    }
}
